﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Rabbit.Domain;
using Rabbit.Domain.Processing;
using Rabbit.Service;
using System.Transactions;

namespace Rabbit.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProcessingController : ControllerBase
    {

        ProcessingService res;

        public ProcessingController(ProcessingService res)
        {
            this.res = res;
        }


        #region 深加工信息

        /// <summary>
        /// 深加工信息
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingInfo(int tmid)
        {
            return Ok(res.GetProcessingInfo(tmid));
        }
        /// <summary>
        /// 添加或修改深加工信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingInfo(ProcessingInfo input)
        {
            return Ok(res.AddProcessingInfo(input));
        }





        #endregion


        #region 食品安全信息

        /// <summary>
        /// 添加食品安全信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingImg(ProcessingImg input)
        {
            return Ok(res.AddProcessingImg(input));
        }
        /// <summary>
        /// 食品安全信息
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingImg(int tmid)
        {
            return Ok(res.GetProcessingImg(tmid));
        }
        /// <summary>
        /// 删除食品安全信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult DelProcessingImg(int ids)
        {
            return Ok(res.DelProcessingImg(ids));
        }

        #endregion


        #region 供应商信息

        /// <summary>
        /// 修改批次
        /// </summary>
        /// <param name="pc"></param>
        /// <param name="tMid"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        public IActionResult Updpc(string pc, int tMid)
        {
            return Ok(res.Updpc(pc, tMid));

        }

        #region 原料相关材料

        /// <summary>
        /// 添加原料相关材料
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingImg2(ProcessingImg input)
        {
            return Ok(res.AddProcessingImg2(input));
        }
        /// <summary>
        /// 原料相关材料
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingImg2(int tmid)
        {
            return Ok(res.GetProcessingImg2(tmid));
        }

        #endregion


        #region 辅料相关材料

        /// <summary>
        /// 添加辅料相关材料
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingImg3(ProcessingImg input)
        {
            return Ok(res.AddProcessingImg3(input));
        }
        /// <summary>
        /// 辅料相关材料
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingImg3(int tmid)
        {
            return Ok(res.GetProcessingImg3(tmid));
        }

        #endregion


        #region 添加剂相关材料

        /// <summary>
        /// 添加添加剂相关材料
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingImg4(ProcessingImg input)
        {
            return Ok(res.AddProcessingImg4(input));
        }
        /// <summary>
        /// 添加剂相关材料
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingImg4(int tmid)
        {
            return Ok(res.GetProcessingImg4(tmid));
        }

        #endregion


        #region 包材相关材料

        /// <summary>
        /// 包材加剂相关材料
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingImg5(ProcessingImg input)
        {
            return Ok(res.AddProcessingImg5(input));
        }
        /// <summary>
        /// 包材相关材料
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingImg5(int tmid)
        {
            return Ok(res.GetProcessingImg5(tmid));
        }

        #endregion



        #endregion


        #region 深加工企业信息

        /// <summary>
        /// 深加工企业信息
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingQY(int tmid)
        {
            return Ok(res.GetProcessingQY(tmid));
        }
        /// <summary>
        /// 添加或修改深加工企业信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingQY(ProcessingQY input)
        {
            return Ok(res.AddProcessingQY(input));
        }





        #endregion


        #region 企业照片

        /// <summary>
        /// 添加企业照片
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddProcessingImg6(ProcessingImg input)
        {
            return Ok(res.AddProcessingImg6(input));
        }
        /// <summary>
        /// 企业照片
        /// </summary>
        /// <param name="tmid"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetProcessingImg6(int tmid)
        {
            return Ok(res.GetProcessingImg6(tmid));
        }

        #endregion




    }
}
